<?php
Class Index extends CI_Controller{
    function __construct()
    {
        parent::__construct();
        $this->load->Model('sanpham_model');
       // $this->load->helper("url");
      }
    public function index(){
		$data['lastests']  =$this->db->select('*')->limit(3)->order_by('id', 'desc')->get('sanpham')->result_array();
        $data['protes']  =$this->sanpham_model->getProductByCate('5,11');
        $data['protes1'] =$this->sanpham_model->getProductByCate('4,10');
        $data['protes2'] =$this->sanpham_model->getProductByCate('3,9');
        $data['category']=$this->sanpham_model->category(0);
        foreach($data['category'] as &$item) {
            $item['items'] = $this->sanpham_model->category($item['id']);			
        }

        $data['table'] = $this->sanpham_model->jointable('prent_id');

        $this->load->view("index-view",$data);
    }
    function category() {

    }
}
?>